#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2.2e7 + 5;

int n, m;
char s[N];
int dp[N];
int manacher() {
  int ans = 0;
  int C = 1, R = 2;
  rep(i, 2, n) {
    if (i < R)
      dp[i] = min(R - i, dp[C * 2 - i]);
    else
      dp[i] = 1;
    while (s[i + dp[i]] == s[i - dp[i]]) dp[i]++;
    ans = max(ans, dp[i] - 1);
    if (i + dp[i] > R) C = i, R = i + dp[i];
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string t;
  cin >> t;
  s[0] = '^';
  s[1] = '#';
  rep(i, 1, t.size()) {
    s[i * 2] = t[i - 1];
    s[i * 2 + 1] = '#';
  }
  n = t.size() * 2 + 1;
  s[n + 1] = '$';
  cout << manacher();
  return 0;
}